package com.whosly.spring.cloud.components.starter.sentry.configure;

import com.whosly.spring.cloud.components.starter.sentry.configure.data.SentryProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * SentryParserConfiguration
 */
@Configuration
//@AutoConfigureAfter({AConfiguration.class})
@EnableConfigurationProperties({SentryProperties.class})
public class SentryParserConfiguration {

    @Autowired
    private SentryProperties sentryProperties;

    public SentryParserConfiguration() {
        //.
    }

    @ConditionalOnProperty(
            prefix = "sentry",
            name = {"enable"},
            havingValue = "true"
    )
    @Bean({"sentryInitConfiguration"})
    public SentryInitBean sentryInitConfiguration() {
        return new SentryInitBean(sentryProperties);
    }

}
